home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / include / linux / mxc_scc2_driver.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-09  |  37.8 KB  |  974 lines

  1.  
  2. /*
  3.  * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
  4.  */
  5.  
  6. /*
  7.  * The code contained herein is licensed under the GNU General Public
  8.  * License. You may obtain a copy of the GNU General Public License
  9.  * Version 2 or later at the following locations:
  10.  *
  11.  * http://www.opensource.org/licenses/gpl-license.html
  12.  * http://www.gnu.org/copyleft/gpl.html
  13.  */
  14.  
  15. #ifndef SCC_DRIVER_H
  16. #define SCC_DRIVER_H
  17.  
  18. /*
  19.  * NAMING CONVENTIONS
  20.  * ==================
  21.  * (A note to maintainers and other interested parties)
  22.  *
  23.  * Use scc_ or SCC_ prefix for 'high-level' interface routines and the types
  24.  * passed to those routines.  Try to avoid #defines in these interfaces.
  25.  *
  26.  * Use SMN_ or SCM_ prefix for the #defines used with scc_read_register() and
  27.  * scc_write_register, or values passed/retrieved from those routines.
  28.  */
  29.  
  30. /*! @file mxc_scc2_driver.h
  31.  *
  32.  * @brief (Header file to use the SCC2 driver.)
  33.  *
  34.  * The SCC2 driver is available to other kernel modules directly.  Secure
  35.  * Partition functionality is extended to users through the SHW API.  Other
  36.  * functionality of the SCC2 is limited to kernel-space users.
  37.  *
  38.  * With the exception of #scc_monitor_security_failure(), all routines are
  39.  * 'synchronous', i.e. they will not return to their caller until the requested
  40.  * action is complete, or fails to complete.  Some of these functions could
  41.  * take quite a while to perform, depending upon the request.
  42.  *
  43.  * Routines are provided to:
  44.  * @li trigger a security-violation alarm - #scc_set_sw_alarm()
  45.  * @li get configuration and version information - #scc_get_configuration()
  46.  * @li zeroize memory - #scc_zeroize_memories()
  47.  * @li Work with secure partitions: #scc_allocate_partition()
  48.  *     #scc_engage_partition() #scc_diminish_permissions() 
  49.  *     #scc_release_partition()
  50.  * @li Encrypt or decrypt regions of data: #scc_encrypt_region()
  51.  *     #scc_decrypt_region()
  52.  * @li monitor the Security Failure alarm - #scc_monitor_security_failure()
  53.  * @li stop monitoring Security Failure alarm -
  54.  *     #scc_stop_monitoring_security_failure()
  55.  * @li write registers of the SCC - #scc_write_register()
  56.  * @li read registers of the SCC - #scc_read_register()
  57.  *
  58.  * The SCC2 encrypts and decrypts using Triple DES with an internally stored
  59.  * key.  When the SCC2 is in Secure mode, it uses its secret, unique-per-chip
  60.  * key.  When it is in Non-Secure mode, it uses a default key.  This ensures
  61.  * that secrets stay secret if the SCC2 is not in Secure mode.
  62.  *
  63.  * Not all functions that could be provided in a 'high level' manner have been
  64.  * implemented.  Among the missing are interfaces to the ASC/AIC components and
  65.  * the timer functions.  These and other features must be accessed through
  66.  * #scc_read_register() and #scc_write_register(), using the @c \#define values
  67.  * provided.
  68.  *
  69.  * Here is a glossary of acronyms used in the SCC2 driver documentation:
  70.  * - CBC - Cipher Block Chaining.  A method of performing a block cipher.
  71.  *    Each block is encrypted using some part of the result of the previous
  72.  *    block's encryption.  It needs an 'initialization vector' to seed the
  73.  *    operation.
  74.  * - ECB - Electronic Code Book.  A method of performing a block cipher.
  75.  *    With a given key, a given block will always encrypt to the same value.
  76.  * - DES - Data Encryption Standard.  (8-byte) Block cipher algorithm which
  77.  *    uses 56-bit keys.  In SCC2, this key is constant and unique to the device.
  78.  *    SCC uses the "triple DES" form of this algorithm.
  79.  * - AIC - Algorithm Integrity Checker.
  80.  * - ASC - Algorithm Sequence Checker.
  81.  * - SMN - Security Monitor.  The part of the SCC2 responsible for monitoring
  82.  *    for security problems and notifying the CPU and other PISA components.
  83.  * - SCM - Secure Memory.  The part of the SCC2 which handles the cryptography.
  84.  * - SCC - Security Controller.  Central security mechanism for PISA.
  85.  * - PISA - Platform-Independent Security Architecture.
  86.  */
  87.  
  88. /* Temporarily define compile-time flags to make Doxygen happy. */
  89. #ifdef DOXYGEN_HACK
  90. /** @defgroup scccompileflags SCC Driver compile-time flags
  91.  *
  92.  * These preprocessor flags should be set, if desired, in a makefile so
  93.  * that they show up on the compiler command line.
  94.  */
  95. /** @addtogroup scccompileflags */
  96.  
  97. /** @{ */
  98. /**
  99.  * Compile-time flag to change @ref smnregs and @ref scmregs
  100.  * offset values for the SCC's implementation on the MX.21 board.
  101.  *
  102.  * This must also be set properly for any code which calls the
  103.  * scc_read_register() or scc_write_register() functions or references the
  104.  * register offsets.
  105.  */
  106. #define TAHITI
  107. /** @} */
  108. #undef TAHITI
  109.  
  110. #endif                /* DOXYGEN_HACK */
  111.  
  112. /*! Major Version of the driver.  Used for
  113.     scc_configuration->driver_major_version */
  114. #define SCC_DRIVER_MAJOR_VERSION    2
  115. /*! Old Minor Version of the driver. */
  116. #define SCC_DRIVER_MINOR_VERSION_0    0
  117. /*! Minor Version of the driver.  Used for
  118.     scc_configuration->driver_minor_version */
  119. #define SCC_DRIVER_MINOR_VERSION_2    2
  120.  
  121.  
  122. /*!
  123.  *  Interrupt line number of SCM interrupt.
  124.  */
  125. #define INT_SCC_SCM         MXC_INT_SCC_SCM
  126.  
  127. /*!
  128.  *  Interrupt line number of the SMN interrupt.
  129.  */
  130. #define INT_SCC_SMN         MXC_INT_SCC_SMN
  131.  
  132. /**
  133.  * @typedef scc_return_t
  134.  */
  135. /** Common status return values from SCC driver functions. */
  136.     typedef enum scc_return_t {
  137.         SCC_RET_OK = 0,     /**< Function succeeded  */
  138.         SCC_RET_FAIL,     /**< Non-specific failure */
  139.         SCC_RET_VERIFICATION_FAILED,
  140.                  /**< Decrypt validation failed */
  141.         SCC_RET_TOO_MANY_FUNCTIONS,
  142.                  /**< At maximum registered functions */
  143.         SCC_RET_BUSY,     /**< SCC is busy and cannot handle request */
  144.         /**< Encryption or decryption failed because@c count_out_bytes
  145.             says that @c data_out is too small to hold the value. */
  146.         SCC_RET_INSUFFICIENT_SPACE,
  147.     } scc_return_t;
  148.  
  149. /**
  150.  * @typedef scc_partition_status_t
  151.  */
  152. /** Partition status information. */
  153.     typedef enum scc_partition_status_t {
  154.         SCC_PART_S_UNUSABLE,
  155.                   /**< Partition not implemented */
  156.         SCC_PART_S_UNAVAILABLE,
  157.                   /**< Partition owned by other host */
  158.         SCC_PART_S_AVAILABLE,
  159.                   /**< Partition available */
  160.         SCC_PART_S_ALLOCATED,
  161.                   /**< Partition owned by host but not engaged*/
  162.         SCC_PART_S_ENGAGED,
  163.                   /**< Partition owned by host and engaged */
  164.     } scc_partition_status_t;
  165.  
  166. /**
  167.  * Configuration information about SCC and the driver.
  168.  *
  169.  * This struct/typedef contains information from the SCC and the driver to
  170.  * allow the user of the driver to determine the size of the SCC's memories and
  171.  * the version of the SCC and the driver.
  172.  */
  173.     typedef struct scc_config_t {
  174.         int driver_major_version;
  175.                 /**< Major version of the SCC driver code  */
  176.         int driver_minor_version;
  177.                 /**< Minor version of the SCC driver code  */
  178.         int scm_version; /**< Version from SCM Configuration register */
  179.         int smn_version; /**< Version from SMN Status register */
  180.         /**< Number of bytes per block of RAM; also
  181.             block size of the crypto algorithm. */
  182.         int block_size_bytes;
  183.         int partition_size_bytes;
  184.                 /**< Number of bytes in each partition */
  185.         int partition_count;
  186.                 /**< Number of partitions on this platform */
  187.     } scc_config_t;
  188.  
  189. /**
  190.  * @typedef scc_enc_dec_t
  191.  */
  192. /**
  193.  * Determine whether SCC will run its cryptographic
  194.  * function as an encryption or decryption.
  195.  */
  196.     typedef enum scc_enc_dec_t {
  197.         SCC_ENCRYPT,    /**< Encrypt (from Red to Black) */
  198.         SCC_DECRYPT    /**< Decrypt (from Black to Red) */
  199.     } scc_enc_dec_t;
  200.  
  201. /**
  202.  * @typedef scc_verify_t
  203.  */
  204. /**
  205.  * Tell the driver whether it is responsible for verifying the integrity of a
  206.  * secret.  During an encryption, using other than #SCC_VERIFY_MODE_NONE will
  207.  * cause a check value to be generated and appended to the plaintext before
  208.  * encryption.  During decryption, the check value will be verified after
  209.  * decryption, and then stripped from the message.
  210.  */
  211.     typedef enum scc_verify_t {
  212.     /** No verification value added or checked.  Input plaintext data must be
  213.      *  be a multiple of the blocksize (#scc_get_configuration()).  */
  214.         SCC_VERIFY_MODE_NONE,
  215.     /** Driver will generate/validate a 2-byte CCITT CRC.  Input plaintext
  216.             will be padded to a multiple of the blocksize, adding 3-10 bytes
  217.             to the resulting output ciphertext.  Upon decryption, this padding
  218.             will be stripped, and the CRC will be verified. */
  219.         SCC_VERIFY_MODE_CCITT_CRC
  220.     } scc_verify_t;
  221.  
  222. /**
  223.  * @typedef scc_cypher_mode_t
  224.  */
  225. /**
  226.  * Select the cypher mode to use for partition cover/uncover operations.
  227.  */
  228.  
  229.     typedef enum scc_cypher_mode_t {
  230.         SCC_CYPHER_MODE_ECB = 1,
  231.                    /**< ECB mode */
  232.         SCC_CYPHER_MODE_CBC = 2,
  233.                    /**< CBC mode */
  234.     } scc_cypher_mode_t;
  235.  
  236. /**
  237.  * Allocate a partition of secure memory
  238.  *
  239.  * @param       smid_value  Value to use for the SMID register.  Must be 0 for
  240.  *                          kernel mode ownership.
  241.  * @param[out]  part_no     (If successful) Assigned partition number.
  242.  * @param[out]  part_base   Kernel virtual address of the partition.
  243.  * @param[out]  part_phys   Physical address of the partition.
  244.  *
  245.  * @return      SCC_RET_OK if successful.
  246.  */
  247.     extern scc_return_t
  248.         scc_allocate_partition(uint32_t smid_value,
  249.                    int *part_no,
  250.                    void **part_base, uint32_t *part_phys);
  251.  
  252. /* Note: This function has to be run in the same context (userspace or kernel
  253.  * mode) as the process that will be using the partition.  Because the SCC2 API
  254.  * is not accessible in user mode, this function is also provided as a macro in
  255.  * in fsl_shw.h.  Kernel-mode users that include this file are able to use this
  256.  * version of the function without having to include the whole SHW API.  If the
  257.  * macro definition was defined before we got here, un-define it so this
  258.  * version will be used instead.
  259.  */
  260.  
  261. #ifdef scc_engage_partition
  262. #undef scc_engage_partition
  263. #endif
  264.  
  265. /**
  266.  * Engage partition of secure memory
  267.  *
  268.  * @param part_base (kernel) Virtual
  269.  * @param UMID NULL, or 16-byte UMID for partition security
  270.  * @param permissions ORed values of the type SCM_PERM_* which will be used as
  271.  *                    initial partition permissions.  SHW API users should use
  272.  *                    the FSL_PERM_* definitions instead.
  273.  *
  274.  * @return SCC_RET_OK if successful.
  275.  */
  276.     extern scc_return_t
  277.         scc_engage_partition(void *part_base,
  278.                  const uint8_t *UMID, uint32_t permissions);
  279.  
  280. /**
  281.  * Release a partition of secure memory
  282.  *
  283.  * @param   part_base   Kernel virtual address of the partition to be released.
  284.  *
  285.  * @return  SCC_RET_OK if successful.
  286.  */
  287.     extern scc_return_t scc_release_partition(void *part_base);
  288.  
  289. /**
  290.  * Diminish the permissions on a partition of secure memory
  291.  *
  292.  * @param part_base   Kernel virtual address of the partition.
  293.  *
  294.  * @param permissions ORed values of the type SCM_PERM_* which will be used as
  295.  *                    initial partition permissions.  SHW API users should use
  296.  *                    the FSL_PERM_* definitions instead.
  297.  *
  298.  * @return  SCC_RET_OK if successful.
  299.  */
  300.     extern scc_return_t
  301.         scc_diminish_permissions(void *part_base, uint32_t permissions);
  302.  
  303. /**
  304.  * Query the status of a partition of secure memory
  305.  *
  306.  * @param part_base   Kernel virtual address of the partition.
  307.  *
  308.  * @return  SCC_RET_OK if successful.
  309.  */
  310.     extern scc_partition_status_t scc_partition_status(void *part_base);
  311.  
  312. /**
  313.  * Calculate the physical address from the kernel virtual address.
  314.  */
  315.     extern uint32_t scc_virt_to_phys(void *address);
  316. /*scc_return_t
  317. scc_verify_slot_access(uint64_t owner_id, uint32_t slot, uint32_t access_len);*/
  318.  
  319.  
  320. /**
  321.  * Encrypt a region of secure memory.
  322.  *
  323.  * @param   part_base    Kernel virtual address of the partition.
  324.  * @param   offset_bytes Offset from the start of the partition to the plaintext
  325.  *                       data.
  326.  * @param   byte_count   Length of the region (octets).
  327.  * @param   black_data   Physical location to store the encrypted data.
  328.  * @param   IV           Value to use for the Initialization Vector.
  329.  * @param   cypher_mode  Cyphering mode to use, specified by type
  330.  *                       #scc_cypher_mode_t
  331.  *
  332.  * @return  SCC_RET_OK if successful.
  333.  */
  334.     extern scc_return_t
  335.         scc_encrypt_region(uint32_t part_base, uint32_t offset_bytes,
  336.                    uint32_t byte_count, uint8_t *black_data,
  337.                    uint32_t *IV, scc_cypher_mode_t cypher_mode);
  338.  
  339. /**
  340.  * Decrypt a region into secure memory
  341.  *
  342.  * @param   part_base    Kernel virtual address of the partition.
  343.  * @param   offset_bytes Offset from the start of the partition to store the
  344.  *                       plaintext data.
  345.  * @param   byte_count   Length of the region (octets).
  346.  * @param   black_data   Physical location of the encrypted data.
  347.  * @param   IV           Value to use for the Initialization Vector.
  348.  * @param   cypher_mode  Cyphering mode to use, specified by type
  349.  *                       #scc_cypher_mode_t
  350.  *
  351.  * @return  SCC_RET_OK if successful.
  352.  */
  353.     extern scc_return_t
  354.         scc_decrypt_region(uint32_t part_base, uint32_t offset_bytes,
  355.                    uint32_t byte_count, uint8_t *black_data,
  356.                    uint32_t *IV, scc_cypher_mode_t cypher_mode);
  357.  
  358. /**
  359.  * Retrieve configuration information from the SCC.
  360.  *
  361.  * This function always succeeds.
  362.  *
  363.  * @return   A pointer to the configuration information.  This is a pointer to
  364.  *           static memory and must not be freed.  The values never change, and
  365.  *           the return value will never be null.
  366.  */
  367.     extern scc_config_t *scc_get_configuration(void);
  368.  
  369. /**
  370.  * Zeroize Red and Black memories of the SCC.  This will start the Zeroizing
  371.  * process.  The routine will return when the memories have zeroized or failed
  372.  * to do so.  The driver will poll waiting for this to occur, so this
  373.  * routine must not be called from interrupt level.  Some future version of
  374.  * driver may elect instead to sleep.
  375.  *
  376.  * @return 0 or error if initialization fails.
  377.  */
  378.     extern scc_return_t scc_zeroize_memories(void);
  379.  
  380. /**
  381.  * Signal a software alarm to the SCC.  This will take the SCC and other PISA
  382.  * parts out of Secure mode and into Security Failure mode.  The SCC will stay
  383.  * in failed mode until a reboot.
  384.  *
  385.  * @internal
  386.  * If the SCC is not already in fail state, simply write the
  387.  * #SMN_COMMAND_SET_SOFTWARE_ALARM bit in #SMN_COMMAND_REG.  Since there is no
  388.  * reason to wait for the interrupt to bounce back, simply act as though
  389.  * one did.
  390.  */
  391.     extern void scc_set_sw_alarm(void);
  392.  
  393. /**
  394.  * This routine will register a function to be called should a Security Failure
  395.  * be signalled by the SCC (Security Monitor).
  396.  *
  397.  * The callback function may be called from interrupt level, it may be called
  398.  * from some process' task.  It should therefore not take a long time to
  399.  * perform its operation, and it may not sleep.
  400.  *
  401.  * @param  callback_func  Function pointer to routine which will receive
  402.  *                        notification of the security failure.
  403.  * @return         0 if function was successfully registered, non-zero on
  404.  *                 failure.  See #scc_return_t.
  405.  *
  406.  * @internal
  407.  *  There is a fixed global static array which keeps track of the requests to
  408.  *  monitor the failure.
  409.  *
  410.  *  Add @c callback_func to the first empty slot in #scc_callbacks[].  If there
  411.  *  is no room, return #SCC_RET_TOO_MANY_FUNCTIONS.
  412.  */
  413.     extern scc_return_t scc_monitor_security_failure(void
  414.                              callback_func(void));
  415.  
  416. /**
  417.  * This routine will deregister a function previously registered with
  418.  * #scc_monitor_security_failure().
  419.  *
  420.  * @param callback_func Function pointer to routine previously registered with
  421.  *                      #scc_stop_monitoring_security_failure().
  422.  */
  423.     extern void scc_stop_monitoring_security_failure(void
  424.                              callback_func(void));
  425.  
  426. /**
  427.  * Read value from an SCC register.
  428.  * The offset will be checked for validity (range) as well as whether it is
  429.  * accessible (e.g. not busy, not in failed state) at the time of the call.
  430.  *
  431.  * @param[in]   register_offset  The (byte) offset within the SCC block
  432.  *                               of the register to be queried.  See
  433.  *                              @ref scmregs and @ref smnregs.
  434.  * @param[out]  value            Pointer to where value from the register
  435.  *                               should be placed.
  436.  * @return      0 if OK, non-zero on error.  See #scc_return_t.
  437.  *
  438.  * @internal
  439.  *  Verify that the register_offset is a) valid, b) refers to a readable
  440.  *  register, and c) the SCC is in a state which would allow a read of this
  441.  *  register.
  442.  */
  443.     extern scc_return_t scc_read_register(int register_offset,
  444.                           uint32_t * value);
  445.  
  446. /**
  447.  * Write a new value into an SCC register.
  448.  * The offset will be checked for validity (range) as well as whether it is
  449.  * accessible (e.g. not busy, not in failed state) at the time of the call.
  450.  *
  451.  * @param[in]  register_offset  The (byte) offset within the SCC block
  452.  *                              of the register to be modified.  See
  453.  *                              @ref scmregs and @ref smnregs
  454.  * @param[in]  value            The value to store into the register.
  455.  * @return     0 if OK, non-zero on error.  See #scc_return_t.
  456.  *
  457.  * @internal
  458.  *  Verify that the register_offset is a) valid, b) refers to a writeable
  459.  *  register, and c) the SCC is in a state which would allow a write to this
  460.  *  register.
  461.  */
  462.     extern scc_return_t scc_write_register(int register_offset,
  463.                            uint32_t value);
  464.  
  465. /**
  466.  * @defgroup scmregs SCM Registers
  467.  *
  468.  * These values are offsets into the SCC for the Secure Memory
  469.  * (SCM) registers.  They are used in the @c register_offset parameter of
  470.  * #scc_read_register() and #scc_write_register().
  471.  */
  472. /** @addtogroup scmregs */
  473. /** @{ */
  474. /** Offset of SCM Version ID Register */
  475. #define SCM_VERSION_REG        0x000
  476. /** Offset of SCM Interrupt Control Register */
  477. #define SCM_INT_CTL_REG        0x008
  478. /** Offset of SCM Status Register */
  479. #define SCM_STATUS_REG        0x00c
  480. /** Offset of SCM Error Status Register */
  481. #define SCM_ERR_STATUS_REG    0x010
  482. /** Offset of SCM Fault Address Register */
  483. #define SCM_FAULT_ADR_REG    0x014
  484. /** Offset of SCM Partition Owners Register */
  485. #define SCM_PART_OWNERS_REG    0x018
  486. /** Offset of SCM Partitions Engaged Register */
  487. #define SCM_PART_ENGAGED_REG    0x01c
  488. /** Offset of SCM Unique Number 0 Register */
  489. #define SCM_UNIQUE_ID0_REG    0x020
  490. /** Offset of SCM Unique Number 1 Register */
  491. #define SCM_UNIQUE_ID1_REG    0x024
  492. /** Offset of SCM Unique Number 2 Register */
  493. #define SCM_UNIQUE_ID2_REG    0x028
  494. /** Offset of SCM Unique Number 3 Register */
  495. #define SCM_UNIQUE_ID3_REG    0x02c
  496. /** Offset of SCM Zeroize Command Register */
  497. #define SCM_ZCMD_REG        0x050
  498. /** Offset of SCM Cipher Command Register */
  499. #define SCM_CCMD_REG        0x054
  500. /** Offset of SCM Cipher Black RAM Start Address Register */
  501. #define SCM_C_BLACK_ST_REG    0x058
  502. /** Offset of SCM Internal Debug Register */
  503. #define SCM_DBG_STATUS_REG    0x05c
  504. /** Offset of SCM Cipher IV 0 Register */
  505. #define SCM_AES_CBC_IV0_REG    0x060
  506. /** Offset of SCM Cipher IV 1 Register */
  507. #define SCM_AES_CBC_IV1_REG    0x064
  508. /** Offset of SCM Cipher IV 2 Register */
  509. #define SCM_AES_CBC_IV2_REG    0x068
  510. /** Offset of SCM Cipher IV 3 Register */
  511. #define SCM_AES_CBC_IV3_REG    0x06c
  512. /** Offset of SCM SMID Partition 0 Register */
  513. #define SCM_SMID0_REG        0x080
  514. /** Offset of SCM Partition 0 Access Permissions Register */
  515. #define SCM_ACC0_REG        0x084
  516. /** Offset of SCM SMID Partition 1 Register */
  517. #define SCM_SMID1_REG        0x088
  518. /** Offset of SCM Partition 1 Access Permissions Register */
  519. #define SCM_ACC1_REG        0x08c
  520. /** Offset of SCM SMID Partition 2 Register */
  521. #define SCM_SMID2_REG        0x090
  522. /** Offset of SCM Partition 2 Access Permissions Register */
  523. #define SCM_ACC2_REG        0x094
  524. /** Offset of SCM SMID Partition 3 Register */
  525. #define SCM_SMID3_REG        0x098
  526. /** Offset of SCM Partition 3 Access Permissions Register */
  527. #define SCM_ACC3_REG        0x09c
  528. /** Offset of SCM SMID Partition 4 Register */
  529. #define SCM_SMID4_REG        0x0a0
  530. /** Offset of SCM Partition 4 Access Permissions Register */
  531. #define SCM_ACC4_REG        0x0a4
  532. /** Offset of SCM SMID Partition 5 Register */
  533. #define SCM_SMID5_REG        0x0a8
  534. /** Offset of SCM Partition 5 Access Permissions Register */
  535. #define SCM_ACC5_REG        0x0ac
  536. /** Offset of SCM SMID Partition 6 Register */
  537. #define SCM_SMID6_REG        0x0b0
  538. /** Offset of SCM Partition 6 Access Permissions Register */
  539. #define SCM_ACC6_REG        0x0b4
  540. /** Offset of SCM SMID Partition 7 Register */
  541. #define SCM_SMID7_REG        0x0b8
  542. /** Offset of SCM Partition 7 Access Permissions Register */
  543. #define SCM_ACC7_REG        0x0bc
  544. /** Offset of SCM SMID Partition 8 Register */
  545. #define SCM_SMID8_REG        0x0c0
  546. /** Offset of SCM Partition 8 Access Permissions Register */
  547. #define SCM_ACC8_REG        0x0c4
  548. /** Offset of SCM SMID Partition 9 Register */
  549. #define SCM_SMID9_REG        0x0c8
  550. /** Offset of SCM Partition 9 Access Permissions Register */
  551. #define SCM_ACC9_REG        0x0cc
  552. /** Offset of SCM SMID Partition 10 Register */
  553. #define SCM_SMID10_REG        0x0d0
  554. /** Offset of SCM Partition 10 Access Permissions Register */
  555. #define SCM_ACC10_REG        0x0d4
  556. /** Offset of SCM SMID Partition 11 Register */
  557. #define SCM_SMID11_REG        0x0d8
  558. /** Offset of SCM Partition 11 Access Permissions Register */
  559. #define SCM_ACC11_REG        0x0dc
  560. /** Offset of SCM SMID Partition 12 Register */
  561. #define SCM_SMID12_REG        0x0e0
  562. /** Offset of SCM Partition 12 Access Permissions Register */
  563. #define SCM_ACC12_REG        0x0e4
  564. /** Offset of SCM SMID Partition 13 Register */
  565. #define SCM_SMID13_REG        0x0e8
  566. /** Offset of SCM Partition 13 Access Permissions Register */
  567. #define SCM_ACC13_REG        0x0ec
  568. /** Offset of SCM SMID Partition 14 Register */
  569. #define SCM_SMID14_REG        0x0f0
  570. /** Offset of SCM Partition 14 Access Permissions Register */
  571. #define SCM_ACC14_REG        0x0f4
  572. /** Offset of SCM SMID Partition 15 Register */
  573. #define SCM_SMID15_REG        0x0f8
  574. /** Offset of SCM Partition 15 Access Permissions Register */
  575. #define SCM_ACC15_REG        0x0fc
  576. /** @} */
  577.  
  578. /** Number of bytes of register space for the SCM. */
  579. #define SCM_REG_BANK_SIZE    0x100
  580.  
  581. /** Number of bytes of register space for the SCM. */
  582. #define SCM_REG_BANK_SIZE    0x100
  583.  
  584. /** Offset of the SMN registers */
  585. #define SMN_ADDR_OFFSET        0x100
  586.  
  587. /**
  588.  * @defgroup smnregs SMN Registers
  589.  *
  590.  * These values are offsets into the SCC for the Security Monitor
  591.  * (SMN) registers.  They are used in the @c register_offset parameter of the
  592.  * #scc_read_register() and #scc_write_register().
  593.  */
  594. /** @addtogroup smnregs */
  595. /** @{ */
  596. /** Offset of SMN Status Register */
  597. #define SMN_STATUS_REG        (SMN_ADDR_OFFSET+0x00000000)
  598. /** Offset of SMH Command Register */
  599. #define SMN_COMMAND_REG        (SMN_ADDR_OFFSET+0x00000004)
  600. /** Offset of SMH Sequence Start Register */
  601. #define SMN_SEQ_START_REG    (SMN_ADDR_OFFSET+0x00000008)
  602. /** Offset of SMH Sequence End Register */
  603. #define SMN_SEQ_END_REG        (SMN_ADDR_OFFSET+0x0000000c)
  604. /** Offset of SMH Sequence Check Register */
  605. #define SMN_SEQ_CHECK_REG    (SMN_ADDR_OFFSET+0x00000010)
  606. /** Offset of SMH BitBank Count Register */
  607. #define SMN_BB_CNT_REG        (SMN_ADDR_OFFSET+0x00000014)
  608. /** Offset of SMH BitBank Increment Register */
  609. #define SMN_BB_INC_REG        (SMN_ADDR_OFFSET+0x00000018)
  610. /** Offset of SMH BitBank Decrement Register */
  611. #define SMN_BB_DEC_REG        (SMN_ADDR_OFFSET+0x0000001c)
  612. /** Offset of SMH Compare Register */
  613. #define SMN_COMPARE_REG        (SMN_ADDR_OFFSET+0x00000020)
  614. /** Offset of SMH Plaintext Check Register */
  615. #define SMN_PT_CHK_REG        (SMN_ADDR_OFFSET+0x00000024)
  616. /** Offset of SMH Ciphertext Check Register */
  617. #define SMN_CT_CHK_REG        (SMN_ADDR_OFFSET+0x00000028)
  618. /** Offset of SMH Timer Initial Value Register */
  619. #define SMN_TIMER_IV_REG    (SMN_ADDR_OFFSET+0x0000002c)
  620. /** Offset of SMH Timer Control Register */
  621. #define SMN_TIMER_CTL_REG    (SMN_ADDR_OFFSET+0x00000030)
  622. /** Offset of SMH Security Violation Register */
  623. #define SMN_SEC_VIO_REG        (SMN_ADDR_OFFSET+0x00000034)
  624. /** Offset of SMH Timer Register */
  625. #define SMN_TIMER_REG        (SMN_ADDR_OFFSET+0x00000038)
  626. /** Offset of SMH High-Assurance Control Register */
  627. #define SMN_HAC_REG        (SMN_ADDR_OFFSET+0x0000003c)
  628. /** Number of bytes allocated to the SMN registers */
  629. #define SMN_REG_BANK_SIZE    0x40
  630. /** @} */
  631.  
  632. /** Number of bytes of total register space for the SCC. */
  633. #define SCC_ADDRESS_RANGE    (SMN_ADDR_OFFSET + SMN_REG_BANK_SIZE)
  634.  
  635. /**
  636.  * @defgroup smnstatusregdefs SMN Status Register definitions (SMN_STATUS)
  637.  */
  638. /** @addtogroup smnstatusregdefs */
  639. /** @{ */
  640. /** SMN version id. */
  641. #define SMN_STATUS_VERSION_ID_MASK        0xfc000000
  642. /**  number of bits to shift #SMN_STATUS_VERSION_ID_MASK to get it to LSB */
  643. #define SMN_STATUS_VERSION_ID_SHIFT       28
  644. /** Illegal bus master access attempted. */
  645. #define SMN_STATUS_ILLEGAL_MASTER         0x01000000
  646. /** Scan mode entered/exited since last reset. */
  647. #define SMN_STATUS_SCAN_EXIT              0x00800000
  648. /** Some security peripheral is initializing */
  649. #define SMN_STATUS_PERIP_INIT             0x00010000
  650. /** Internal error detected in SMN. */
  651. #define SMN_STATUS_SMN_ERROR              0x00008000
  652. /** SMN has an outstanding interrupt. */
  653. #define SMN_STATUS_SMN_STATUS_IRQ         0x00004000
  654. /** Software Alarm was triggered. */
  655. #define SMN_STATUS_SOFTWARE_ALARM         0x00002000
  656. /** Timer has expired. */
  657. #define SMN_STATUS_TIMER_ERROR            0x00001000
  658. /** Plaintext/Ciphertext compare failed. */
  659. #define SMN_STATUS_PC_ERROR               0x00000800
  660. /** Bit Bank detected overflow or underflow */
  661. #define SMN_STATUS_BITBANK_ERROR          0x00000400
  662. /** Algorithm Sequence Check failed. */
  663. #define SMN_STATUS_ASC_ERROR              0x00000200
  664. /** Security Policy Block detected error. */
  665. #define SMN_STATUS_SECURITY_POLICY_ERROR  0x00000100
  666. /** Security Violation Active error. */
  667. #define SMN_STATUS_SEC_VIO_ACTIVE_ERROR   0x00000080
  668. /** Processor booted from internal ROM. */
  669. #define SMN_STATUS_INTERNAL_BOOT          0x00000020
  670. /** SMN's internal state. */
  671. #define SMN_STATUS_STATE_MASK             0x0000001F
  672. /** Number of bits to shift #SMN_STATUS_STATE_MASK to get it to LSB. */
  673. #define SMN_STATUS_STATE_SHIFT            0
  674. /** @} */
  675.  
  676. /**
  677.  * @defgroup sccscmstates SMN Model Secure State Controller States (SMN_STATE_MASK)
  678.  */
  679. /** @addtogroup sccscmstates */
  680. /** @{ */
  681. /** This is the first state of the SMN after power-on reset  */
  682. #define SMN_STATE_START         0x0
  683. /** The SMN is zeroizing its RAM during reset */
  684. #define SMN_STATE_ZEROIZE_RAM   0x5
  685. /** SMN has passed internal checks, and is waiting for Software check-in */
  686. #define SMN_STATE_HEALTH_CHECK  0x6
  687. /** Fatal Security Violation.  SMN is locked, SCM is inoperative. */
  688. #define SMN_STATE_FAIL          0x9
  689. /** SCC is in secure state.  SCM is using secret key. */
  690. #define SMN_STATE_SECURE        0xA
  691. /** Due to non-fatal error, device is not secure.  SCM is using default key. */
  692. #define SMN_STATE_NON_SECURE    0xC
  693. /** @} */
  694.  
  695. /** @{ */
  696. /** SCM Status bit: Key Status is Default Key in Use */
  697. #define SCM_STATUS_KST_DEFAULT_KEY    0x80000000
  698. /** SCM Status bit: Key Status is (reserved) */
  699. #define SCM_STATUS_KST_RESERVED1    0x40000000
  700. /** SCM Status bit: Key status is Wrong Key */
  701. #define SCM_STATUS_KST_WRONG_KEY    0x20000000
  702. /** SCM Status bit: Bad Key detected */
  703. #define SCM_STATUS_KST_BAD_KEY    0x10000000
  704. /** SCM Status bit: Error has occurred */
  705. #define SCM_STATUS_ERR        0x00008000
  706. /** SCM Status bit: Monitor State is Failed */
  707. #define SCM_STATUS_MSS_FAIL    0x00004000
  708. /** SCM Status bit: Monitor State is Secure */
  709. #define SCM_STATUS_MSS_SEC    0x00002000
  710. /** SCM Status bit: Secure Storage is Failed */
  711. #define SCM_STATUS_RSS_FAIL    0x00000400
  712. /** SCM Status bit: Secure Storage is Secure */
  713. #define SCM_STATUS_RSS_SEC    0x00000200
  714. /** SCM Status bit: Secure Storage is Initializing */
  715. #define SCM_STATUS_RSS_INIT    0x00000100
  716. /** SCM Status bit: Unique Number Valid */
  717. #define SCM_STATUS_UNV        0x00000080
  718. /** SCM Status bit: Big Endian mode */
  719. #define SCM_STATUS_BIG        0x00000040
  720. /** SCM Status bit: Using Secret Key */
  721. #define SCM_STATUS_USK        0x00000020
  722. /** SCM Status bit: Ram is being blocked */
  723. #define SCM_STATUS_BAR        0x00000010
  724. /** Bit mask of SRS */
  725. #define SCM_STATUS_SRS_MASK    0x0000000F
  726. /** Number of bits to shift SRS to/from MSb */
  727. #define SCM_STATUS_SRS_SHIFT    0
  728. /** @} */
  729.  
  730. #define SCM_STATUS_SRS_RESET    0x0    /**< Reset, Zeroise All */
  731. #define SCM_STATUS_SRS_READY    0x1    /**< All Ready */
  732. #define SCM_STATUS_SRS_ZBUSY    0x2    /**< Zeroize Busy (Partition Only) */
  733. #define SCM_STATUS_SRS_CBUSY    0x3    /**< Cipher Busy */
  734. #define SCM_STATUS_SRS_ABUSY    0x4    /**< All Busy */
  735. #define SCM_STATUS_SRS_ZDONE    0x5    /**< Zeroize Done, Cipher Ready */
  736. #define SCM_STATUS_SRS_CDONE    0x6    /**< Cipher Done, Zeroize Ready */
  737. #define SCM_STATUS_SRS_ZDONE2    0x7    /**< Zeroize Done, Cipher Busy */
  738. #define SCM_STATUS_SRS_CDONE2    0x8    /**< Cipher Done, Zeroize Busy */
  739. #define SCM_STATUS_SRS_ADONE    0xD    /**< All Done */
  740.  
  741. /* Format of the SCM VERSION ID REGISTER */
  742. #define SCM_VER_BPP_MASK    0xFF000000    /**< Bytes Per Partition Mask */
  743. #define SCM_VER_BPP_SHIFT   24        /**< Bytes Per Partition Shift */
  744. #define SCM_VER_BPCB_MASK   0x001F0000    /**< Bytes Per Cipher Block Mask */
  745. #define SCM_VER_BPCB_SHIFT  16        /**< Bytes Per Cipher Block Shift */
  746. #define SCM_VER_NP_MASK     0x0000F000    /**< Number of Partitions Mask */
  747. #define SCM_VER_NP_SHIFT    12        /**< Number of Partitions Shift */
  748. #define SCM_VER_MAJ_MASK    0x00000F00    /**< Major Version Mask */
  749. #define SCM_VER_MAJ_SHIFT   8        /**< Major Version Shift */
  750. #define SCM_VER_MIN_MASK    0x000000FF    /**< Minor Version Mask */
  751. #define SCM_VER_MIN_SHIFT   0        /**< Minor Version Shift */
  752.  
  753. /**< SCC Hardware version supported by this driver */
  754. #define SCM_MAJOR_VERSION_2 2
  755.  
  756. /* Format of the SCM ERROR STATUS REGISTER */
  757. #define SCM_ERRSTAT_MID_MASK    0x00F00000  /**< Master ID Mask */
  758. #define SCM_ERRSTAT_MID_SHIFT   20        /**< Master ID Shift */
  759. #define SCM_ERRSTAT_ILM         0x00080000  /**< Illegal Master */
  760. #define SCM_ERRSTAT_SUP         0x00008000  /**< Supervisor Access */
  761. #define SCM_ERRSTAT_ERC_MASK    0x00000F00  /**< Error Code Mask */
  762. #define SCM_ERRSTAT_ERC_SHIFT   8        /**< Error Code Shift */
  763. #define SCM_ERRSTAT_SMS_MASK    0x000000F0  /**< Secure Monitor State Mask */
  764. #define SCM_ERRSTAT_SMS_SHIFT   4        /**< Secure Monitor State Shift */
  765. #define SCM_ERRSTAT_SRS_MASK    0x0000000F  /**< Secure Ram State Mask */
  766. #define SCM_ERRSTAT_SRS_SHIFT   0        /**< Secure Ram State Shift */
  767.  
  768. /* SCM ERROR STATUS REGISTER ERROR CODES */
  769. #define SCM_ERCD_UNK_ADDR       0x1 /**< Unknown Address */
  770. #define SCM_ERCD_UNK_CMD        0x2 /**< Unknown Command */
  771. #define SCM_ERCD_READ_PERM      0x3 /**< Read Permission Error */
  772. #define SCM_ERCD_WRITE_PERM     0x4 /**< Write Permission Error */
  773. #define SCM_ERCD_DMA_ERROR      0x5 /**< DMA Error */
  774. #define SCM_ERCD_BLK_OVFL       0x6 /**< Encryption Block Length Overflow */
  775. #define SCM_ERCD_NO_KEY         0x7 /**< Key Not Engaged */
  776. #define SCM_ERCD_ZRZ_OVFL       0x8 /**< Zeroize Command Queue Overflow */
  777. #define SCM_ERCD_CPHR_OVFL      0x9 /**< Cipher Command Queue Overflow */
  778. #define SCM_ERCD_PROC_INTR      0xA /**< Process Interrupted */
  779. #define SCM_ERCD_WRNG_KEY       0xB /**< Wrong Key */
  780. #define SCM_ERCD_DEVICE_BUSY    0xC /**< Device Busy */
  781. #define SCM_ERCD_UNALGN_ADDR    0xD /**< DMA Unaligned Address */
  782.  
  783. /* Format of the CIPHER COMMAND REGISTER */
  784. #define SCM_CCMD_LENGTH_MASK    0xFFF00000 /**< Cipher Length Mask */
  785. #define SCM_CCMD_LENGTH_SHIFT    20       /**< Cipher Length Shift */
  786. #define SCM_CCMD_OFFSET_MASK    0x000FFF00 /**< Block Offset Mask */
  787. #define SCM_CCMD_OFFSET_SHIFT    8       /**< Block Offset Shift */
  788. #define SCM_CCMD_PART_MASK    0x000000F0     /**< Partition Number Mask */
  789. #define SCM_CCMD_PART_SHIFT    4           /**< Partition Number Shift */
  790. #define SCM_CCMD_CCMD_MASK    0x0000000F     /**< Cipher Command Mask */
  791. #define SCM_CCMD_CCMD_SHIFT    0           /**< Cipher Command Shift */
  792.  
  793. /* Values for SCM_CCMD_CCMD field */
  794. #define SCM_CCMD_AES_DEC_ECB 1 /**< Decrypt without Chaining (ECB) */
  795. #define SCM_CCMD_AES_ENC_ECB 3 /**< Encrypt without Chaining (ECB) */
  796. #define SCM_CCMD_AES_DEC_CBC 5 /**< Decrypt with Chaining (CBC) */
  797. #define SCM_CCMD_AES_ENC_CBC 7 /**< Encrypt with Chaining (CBC) */
  798.  
  799. #define SCM_CCMD_AES     1     /**< Use AES Mode */
  800. #define SCM_CCMD_DEC     0     /**< Decrypt */
  801. #define SCM_CCMD_ENC     2     /**< Encrypt */
  802. #define SCM_CCMD_ECB     0     /**< Perform operation without chaining (ECB) */
  803. #define SCM_CCMD_CBC     4     /**< Perform operation with chaining (CBC) */
  804.  
  805. /* Format of the ZEROIZE COMMAND REGISTER */
  806. #define SCM_ZCMD_PART_MASK    0x000000F0  /**< Target Partition Mask */
  807. #define SCM_ZCMD_PART_SHIFT    4        /**< Target Partition Shift */
  808. #define SCM_ZCMD_CCMD_MASK    0x0000000F  /**< Zeroize Command Mask */
  809. #define SCM_ZCMD_CCMD_SHIFT    0        /**< Zeroize Command Shift */
  810.  
  811. /* MASTER ACCESS PERMISSIONS REGISTER */
  812. /* Note that API users should use the FSL_PERM_ defines instead of these */
  813. /** SCM Access Permission: Do not zeroize/deallocate partition
  814.     on SMN Fail state */
  815. #define SCM_PERM_NO_ZEROIZE    0x10000000
  816. /** SCM Access Permission: Ignore Supervisor/User mode
  817.     in permission determination */
  818. #define SCM_PERM_HD_SUP_DISABLE    0x00000800
  819. /** SCM Access Permission: Allow Read Access to  Host Domain */
  820. #define SCM_PERM_HD_READ    0x00000400
  821. /** SCM Access Permission: Allow Write Access to  Host Domain */
  822. #define SCM_PERM_HD_WRITE    0x00000200
  823. /** SCM Access Permission: Allow Execute Access to  Host Domain */
  824. #define SCM_PERM_HD_EXECUTE    0x00000100
  825. /** SCM Access Permission: Allow Read Access to Trusted Host Domain */
  826. #define SCM_PERM_TH_READ    0x00000040
  827. /** SCM Access Permission: Allow Write Access to Trusted Host Domain */
  828. #define SCM_PERM_TH_WRITE    0x00000020
  829. /** SCM Access Permission: Allow Read Access to Other/World Domain */
  830. #define SCM_PERM_OT_READ    0x00000004
  831. /** SCM Access Permission: Allow Write Access to Other/World Domain */
  832. #define SCM_PERM_OT_WRITE    0x00000002
  833. /** SCM Access Permission: Allow Execute Access to Other/World Domain */
  834. #define SCM_PERM_OT_EXECUTE    0x00000001
  835. /**< Valid bits that can be set in the Permissions register */
  836. #define SCM_PERM_MASK 0xC0000F67
  837.  
  838. /* Zeroize Command register definitions */
  839. #define ZCMD_DEALLOC_PART 3     /**< Deallocate Partition */
  840. #define Z_INT_EN    0x00000002   /**< Zero Interrupt Enable */
  841.  
  842. /**
  843.  * @defgroup scmpartitionownersregdefs SCM Partition Owners Register
  844.  */
  845. /** @addtogroup scmpartitionownersregdefs */
  846. /** @{ */
  847. /** Number of bits to shift partition number to get to its field. */
  848. #define SCM_POWN_SHIFT   2
  849. /** Mask for a field once the register has been shifted. */
  850. #define SCM_POWN_MASK    3
  851. /** Partition is free */
  852. #define SCM_POWN_PART_FREE       0
  853. /** Partition is unable to be allocated */
  854. #define SCM_POWN_PART_UNUSABLE   1
  855. /** Partition is owned by another master */
  856. #define SCM_POWN_PART_OTHER      2
  857. /** Partition is owned by this master */
  858. #define SCM_POWN_PART_OWNED      3
  859. /** @} */
  860.  
  861. /**
  862.  * @defgroup smnpartitionsengagedregdefs SCM Partitions Engaged Register
  863.  */
  864. /** @addtogroup smnpartitionsengagedregdefs */
  865. /** @{ */
  866. /** Number of bits to shift partition number to get to its field. */
  867. #define SCM_PENG_SHIFT   1
  868. /** Engaged value for a field once the register has been shifted. */
  869. #define SCM_PENG_ENGAGED    1
  870. /** @} */
  871.  
  872. /** Number of bytes between each subsequent SMID register */
  873. #define SCM_SMID_WIDTH      8
  874.  
  875. /**
  876.  * @defgroup smncommandregdefs SMN Command Register Definitions (SMN_COMMAND_REG)
  877.  */
  878. /** @addtogroup smncommandregdefs */
  879. /** @{ */
  880.  
  881. /** These bits are unimplemented or reserved */
  882. #define SMN_COMMAND_ZEROS_MASK   0xfffffff0
  883. #define SMN_COMMAND_CLEAR_INTERRUPT     0x8 /**< Clear SMN Interrupt */
  884. #define SMN_COMMAND_CLEAR_BIT_BANK      0x4 /**< Clear SMN Bit Bank */
  885. #define SMN_COMMAND_ENABLE_INTERRUPT    0x2 /**< Enable SMN Interrupts */
  886. #define SMN_COMMAND_SET_SOFTWARE_ALARM  0x1 /**< Set Software Alarm */
  887. /** @} */
  888.  
  889. /**
  890.  * @defgroup smntimercontroldefs SMN Timer Control Register definitions (SMN_TIMER_CONTROL)
  891.  */
  892. /** @addtogroup smntimercontroldefs */
  893. /** @{ */
  894. /** These bits are reserved or zero */
  895. #define SMN_TIMER_CTRL_ZEROS_MASK 0xfffffffc
  896. /** Load the timer from #SMN_TIMER_IV_REG */
  897. #define SMN_TIMER_LOAD_TIMER             0x2
  898. /** Setting to zero stops the Timer */
  899. #define SMN_TIMER_STOP_MASK              0x1
  900. /** Setting this value starts the timer */
  901. #define SMN_TIMER_START_TIMER            0x1
  902. /** @} */
  903.  
  904. /**
  905.  * @defgroup scmchainmodedefs SCM_CHAINING_MODE_MASK - Bit definitions
  906.  */
  907. /** @addtogroup scmchainmodedefs */
  908. /** @{ */
  909. #define SCM_CBC_MODE            0x2 /**< Cipher block chaining */
  910. #define SCM_ECB_MODE            0x0 /**< Electronic codebook. */
  911. /** @} */
  912.  
  913. /* Bit definitions in the SCM_CIPHER_MODE_MASK */
  914. /**
  915.  * @defgroup scmciphermodedefs SCM_CIPHER_MODE_MASK - Bit definitions
  916.  */
  917. /** @addtogroup scmciphermodedefs */
  918. /** @{ */
  919. #define SCM_DECRYPT_MODE        0x1 /**< decrypt from black to red memory */
  920. #define SCM_ENCRYPT_MODE        0x0 /**< encrypt from red to black memory */
  921. /** @} */
  922.  
  923. /**
  924.  * @defgroup smndbgdetdefs SMN Debug Detector Status Register (SCM_DEBUG_DETECT_STAT)
  925.  */
  926. /** @addtogroup smndbgdetdefs */
  927. /** @{ */
  928. #define SMN_DBG_ZEROS_MASK  0xfffff000 /**< These bits are zero or reserved */
  929. #define SMN_DBG_D12             0x0800 /**< Error detected on Debug Port D12 */
  930. #define SMN_DBG_D11             0x0400 /**< Error detected on Debug Port D11 */
  931. #define SMN_DBG_D10             0x0200 /**< Error detected on Debug Port D10 */
  932. #define SMN_DBG_D9              0x0100 /**< Error detected on Debug Port D9 */
  933. #define SMN_DBG_D8              0x0080 /**< Error detected on Debug Port D8 */
  934. #define SMN_DBG_D7              0x0040 /**< Error detected on Debug Port D7 */
  935. #define SMN_DBG_D6              0x0020 /**< Error detected on Debug Port D6 */
  936. #define SMN_DBG_D5              0x0010 /**< Error detected on Debug Port D5 */
  937. #define SMN_DBG_D4              0x0008 /**< Error detected on Debug Port D4 */
  938. #define SMN_DBG_D3              0x0004 /**< Error detected on Debug Port D3 */
  939. #define SMN_DBG_D2              0x0002 /**< Error detected on Debug Port D2 */
  940. #define SMN_DBG_D1              0x0001 /**< Error detected on Debug Port D1 */
  941. /** @} */
  942.  
  943. /** Mask for the usable bits of the Sequence Start Register
  944.     (#SMN_SEQ_START_REG) */
  945. #define SMN_SEQUENCE_START_MASK    0x0000ffff
  946.  
  947. /** Mask for the usable bits of the Sequence End Register
  948.     (#SMN_SEQ_END_REG) */
  949. #define SMN_SEQUENCE_END_MASK      0x0000ffff
  950.  
  951. /** Mask for the usable bits of the Sequence Check Register
  952.     (#SMN_SEQ_CHECK_REG) */
  953. #define SMN_SEQUENCE_CHECK_MASK    0x0000ffff
  954.  
  955. /** Mask for the usable bits of the Bit Counter Register
  956.     (#SMN_BB_CNT_REG) */
  957. #define SMN_BIT_COUNT_MASK         0x000007ff
  958.  
  959. /** Mask for the usable bits of the Bit Bank Increment Size Register
  960.     (#SMN_BB_INC_REG) */
  961. #define SMN_BITBANK_INC_SIZE_MASK  0x000007ff
  962.  
  963. /** Mask for the usable bits of the Bit Bank Decrement Register
  964.     (#SMN_BB_DEC_REG) */
  965. #define SMN_BITBANK_DECREMENT_MASK 0x000007ff
  966.  
  967. /** Mask for the usable bits of the Compare Size Register
  968.     (#SMN_COMPARE_REG) */
  969. #define SMN_COMPARE_SIZE_MASK      0x0000003f
  970.  
  971. /*! @} */
  972.  
  973. #endif                /* SCC_DRIVER_H */
  974.